package org.cuatrovientos.kart;

import java.util.Random;

public class Vehicle {

	protected String name="";
	protected int speed;
	protected int grip;
	protected  int aceleration;
	
	protected Random random = new Random();

	/**
	 * constructor with name parameter
	 * @param name
	 */
	public Vehicle(String name) {
		super();
		this.name = name;
		start();
	}

	/**
	 * Getter for name 
	 * @return
	 */
	public String getName() {
		return name;
	}

	/**
	 * Setter for name 
	 * @return
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * Getter for speed 
	 * @return
	 */
	public int getSpeed() {
		return speed;
	}
	/**
	 * Setter for speed 
	 * @return
	 */
	public void setSpeed(int speed) {
		this.speed = speed;
	}
	/**
	 * Getter for grip 
	 * @return
	 */
	public int getGrip() {
		return grip;
	}
	/**
	 * Setter for grip 
	 * @return
	 */
	public void setGrip(int grip) {
		this.grip = grip;
	}
	/**
	 * Getter for acceleration 
	 * @return
	 */
	public int getAceleration() {
		return aceleration;
	}
	/**
	 * Setter for acceleration 
	 * @return
	 */
	public void setAceleration(int aceleration) {
		this.aceleration = aceleration;
	}
	
	/**
	 *  to string method
	 */
	@Override
	public String toString() {
		return "Vehicle [name=" + name + ", speed=" + speed + ", grip=" + grip
				+ ", aceleration=" + aceleration + "]";
	}
	
	
	 /**
     * Starts values
     */
    private void start() {
            for (int i = 0; i< 18; i++){
                   
                    switch(random.nextInt(3)){
                   
                            case 0:
                                    speed++;
                                    break;
                            case 1:
                                    aceleration++;
                                    break;
                            case 2:
                                    grip++;
                                    break;
                    }
            }
           
    }

    /**
     * moving the vehicle
     *
     */
    public int move () {
           
            return speed + aceleration + random.nextInt(6);
           
    }

    /**
     * maneuver the vehicle
     * @return
     */
    public int maneuver(){
           
            return grip+random.nextInt(6);
    }

	
		
}
